/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bdclass;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import javax.swing.JOptionPane;

/**
 *
 * @author DEMRR
 */
public class Leer {
    
    String uss;
    String pass;
    String url;

    Propiedades propi=new Propiedades();
    
    public Propiedades Leer_doc()
    {
        
        try
           {
            
            File f=new File(".");
            FileReader archivo=new FileReader("D:\\DEMRR\\Documents\\NetBeansProjects\\appSanMartin\\config.txt");
            
            BufferedReader bu = new BufferedReader(archivo);
            
            String linea;
                       
            linea = bu.readLine();
                               
            if (linea!=null)
            {
                do
                {
                    if("user".equals(linea.split(",")[0]))
                    {
                        uss=linea.split(",")[1];
                    }
                    if("password".equals(linea.split(",")[0]))
                    {
                        pass=linea.split(",")[1];
                    }
                    if("url".equals(linea.split(",")[0]))
                    {
                        url=linea.split(",")[1];
                    }
                                        
                    linea = bu.readLine();
                }while (linea!=null);
            }
            bu.close();
            
           propi.setUsuario(uss);
           propi.setPassword(pass);
           propi.setDireccion(url);
           
           
           
           }
       catch (Exception e)
           {
               System.err.println(e.toString());
               propi.setDireccion("nada");
               propi.setPassword("nada");
               propi.setUsuario("nada");
           }
        return propi;
    }
    
}
